/* Single_Temp.pde - Example using the MAX6675 Library. Created by Ryan McLaughlin This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. http://creativecommons.org/licenses/by-sa/3.0/ */ #include #include #include // Status LED Pin //int CS = 10; 9 // CS pin on MAX6675 //int SO = 12; 8 // SO pin of MAX6675 //int SCK = 13; 7 // SCK pin of MAX6675 int units = 2; // Units to readout temp (0 = raw, 1 = ˚C, 2 = ˚F) double temperature = 0; // Temperature output variable const int rs = 10, en = 8, d4 = 3, d5 = 2, d6 = 1, d7 = 0; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); // Initialize the MAX6675 Library for our chip MAX6675_Thermocouple thermocouple(4,5,6); // Setup Serial output and LED Pin // MAX6675 Library already sets pin modes for MAX6675 chip! void setup() { //Serial.begin(9600); lcd.begin(16, 2); // Print a message to the LCD. lcd.print("room temp :"); } void loop() { // Read the temp from the MAX6675 temperature = thermocouple.readCelsius(); if(temperature < 0) { // If there is an error with the TC, temperature will be < 0 //Serial.print("Thermocouple Error on CS"); //Serial.println( temperature ); } else { //Serial.print("Current Temperature: "); //Serial.println( temperature ); } lcd.setCursor(0, 1); lcd.print(temperature); // Wait one second before reading again delay(1000); }